package com.beehoo.dcportal.utils;

import java.util.Map;

import com.beehoo.dcportal.common.Constant;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AdminInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 3998363451131322136L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		Map<String, Object> session = ActionContext.getContext().getSession();
		
		String streetId = CommonUtils.nvlToString((String) session.get(Constant.SESSION_STREET_ID));
		String userId = CommonUtils.nvlToString((String) session.get(Constant.SESSION_USER_ID));
		
		if(streetId.equals("") || userId.equals("")){
			return "login";
		}else{
			return invocation.invoke();
		}
		
	}

}
